package com.example.crm.service;

import com.example.crm.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * @author lenovo
 */
public interface IUserService {
    /**
     * 登录
     * @param usrName
     * @param usrPassword
     * @return
     */
    public User login(String usrName, String usrPassword);

    /**
     * 根据用户名查询用户对象
     * @param usrName
     * @return
     */
    public User getUserByUsrName(String usrName);

    /**
     * 新增和修改
     * @param user
     * @return
     */
    public void saveUser(User user);

    /**
     * 删除
     * @param usrId
     * @return
     */
    public void deleteUser(Long usrId);

    /**
     * 根据usrId查询
     * @param usrId
     * @return
     */
    public User getUser(Long usrId);

    /**
     * 按条件进行分页查询(动态SQL)
     * @param usrName
     * @param roleId
     * @param pageable
     * @return
     */
    public Page<User> findUsers(String usrName, Long roleId, Pageable pageable);

    /**
     * Md5Hash加密
     * @param plaintextPassword
     * @return
      */
    public String encryptPassword(Object plaintextPassword);
}
